#include "headfiles.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 2) {
        cout << "Usage: " << argv[0] << " file" << endl;
        return 0;
    }

    string file_name(argv[1]);
    vector<TNODE *> node_list;
    TNODE *root;

    // Create a binary tree
    root = createBinaryTree(file_name.c_str(), node_list);

    printBinaryTreeLevel(root);

    cout << endl;
    int node_num = containNodes(root, node_list[0], NULL);
    cout << "contained node num = " << node_num << endl;

    // Test least common ancestor
    TNODE *n = leastCommonAncestor(root, node_list[7], node_list[9]);
    cout << "LCA = " << n->val << endl;

    destroyBinaryTree(root);

    return 0;
}

